<?php echo $javascript->link('thickbox', false); ?>
<div class="profiles view surdeigsprofil">
	<h2><span><?php  __('Baker Profile');?></span></h2>
	
	
	<div class="avetar">
		<?php echo $this->renderElement('../profiles/thumb', array("profile" => $profile)); ?>
	</div>
	<div class="holder">
		
		<?php if(isset($can_edit)): ?>
		<?php echo $html->link(__('Edit profile', true), array('action'=>'edit'),array('class'=>'button-link edit-profile')); ?>
		<?php endif; ?>
		<strong><?php echo $html->link(__('List all profiles', true), array('action'=>'index')); ?></strong>
		<h1><?php __('Profile for ')?> <?php echo $profile['Profile']['slug']; ?></h1>
		<p class="large">
			<?php if(empty($profile['Profile']['bio'])): ?>
				<?php __('There has not been added any bio!'); ?>
			<?php else: ?>
				<?php echo $profile['Profile']['bio']; ?>
			<?php endif; ?>
			
		</p>

		<dl>
			
			<dt><?php __('Baking information'); ?></dt>
			<dd>
				<?php $unset = true; if( !empty($profile['Profile']['baking_sourdough']) ):?>
				<?php __('Baking with sourdough.');$unset = false; ?><br />
				<?php endif; ?>
				<?php if( !empty($profile['Profile']['baking_yeast']) ):?>
				<?php __('Baking with yeast.'); $unset = false; ?>
				<?php endif; ?>
				<?php if( $unset ):?>
				<?php __('Bakes with neather sourdough nor yeast.'); ?>
				<?php endif; ?>
			</dd>
			
			
			<?php if( !empty($profile['Profile']['realname']) ):?>
			<dt><?php __('Real name'); ?></dt>
			<dd>
				<?php echo $profile['Profile']['realname']; ?>
			</dd>
			<?php endif; ?>
			
			<?php if( !empty($profile['Profile']['occupation']) ):?>
			<dt><?php __('Occupation'); ?></dt>
			<dd>
				<?php echo $profile['Profile']['occupation']; ?>
			</dd>
			
			<?php endif; ?>
			
			<?php if( !empty($profile['Profile']['phone']) ):?>
			<dt><?php __('Phone'); ?></dt>
			<dd>
				<?php echo $profile['Profile']['phone']; ?>
			</dd>
			
			<?php endif; ?>
			
			<?php if( !empty($profile['Profile']['url']) ):?>
			<dt><?php __('Homepage user'); ?></dt>
			<dd>
				<?php echo $html->link($profile['Profile']['url'], $profile['Profile']['url'], array('target'=>'_blank')); ?>
			</dd>
			<?php endif; ?>
			
			<?php if( !empty($profile['Profile']['birthday']) ):?>
			<dt><?php __('Age'); ?></dt>
			<dd>
				<?php echo $utility->birthday($profile['Profile']['birthday']);?>
			</dd>
			<?php endif; ?>
			
			<dt><?php __('Member since'); ?></dt>
			<dd>
				<?php echo $time->niceShort($profile['User']['created']); ?>
			</dd>
		</dl>
		<div class="location">
			<strong class="title">
				<?php if(isset($can_edit)): ?>
				<?php echo $html->link(__('Change location', true), array('action'=>'editmap'),array('class'=>'button-link')); ?>
				<?php endif; ?>
				<?php __('Location'); ?>: 
				<?php echo $profile['Profile']['location']; ?> 
			</strong>
			<?php echo $this->renderElement('mapjs'); ?>
			
			<div id="map" style=""></div>

			<script type="text/javascript">
				//<![CDATA[
				google.load("maps", "2.x");
				jQuery(document).ready(function() {
					if (GBrowserIsCompatible()) {
					var map = new GMap2(jQuery("#map").get(0));
					map.addControl(new GSmallMapControl());
					<?php
					if(empty($profile['Profile']['zoom'])) {
						$zoom = Configure::read('Map.zoom');
					} else {
						$zoom = $profile['Profile']['zoom'];
					}
					$lat = $profile['Profile']['latitude'];
					$lon = $profile['Profile']['longitude'];
					echo "var zoom = $zoom;
						var lat = $lat;
						var lon = $lon;";?>
					var point = new GLatLng(lat,lon);
					var marker = new GMarker(point);
					map.addOverlay(marker);
					map.setCenter(point, zoom);
					}
				});
				//]]>
			</script>

		</div>
	</div>
</div>

